#
# Kurella/Rapp: The role of issue salience and competitive advantages in spatial models of political competition
#
# Replication Material: Figure 3
#
#
######################################



library(haven)

ches <- read_dta("1999-2019_CHES_dataset_means(v2).dta")



dwest <- ches[ches$vote>5 & ches$eastwest==1,]


par(mar=c(5.1,4.1,4.1,2.1),mfrow=c(1,2))

mycol <- ifelse(dwest$family==7, "darkblue", "grey")
plot(dwest$lrecon,dwest$environment, pch=19,
     #cex=mycex,
     col=mycol,ylim=c(0,10),xlim=c(0,10),
     xlab="Economic left-right",
     ylab="Environmental policy",
     main="a) Environment, CHES 2010-2019")
text(dwest$lrecon[dwest$family==7 & dwest$environment>3 & !is.na(dwest$environment)],
     dwest$environment[dwest$family==7 & dwest$environment>3 & !is.na(dwest$environment)],
     c("SF", "Greng"), pos=3, col="darkblue")
legend("bottomright", pch=19, bty = "n",col=c("darkblue", "grey"), 
       legend=c("green parties", "other parties"))


mycol <- ifelse(dwest$family==1, "darkblue", "grey")
plot(dwest$lrecon, dwest$immigrate_policy,pch=19,
     #cex=mycex,
     col=mycol,ylim=c(0,10),xlim=c(0,10),
     xlab="Economic left-right",
     ylab="Immigration policy",
     main="b) Immigration, CHES 2006-2019")
text(dwest$lrecon[dwest$family==1 & dwest$immigrate_policy<8 & !is.na(dwest$immigrate_policy)],
     dwest$immigrate_policy[dwest$family==1 & dwest$immigrate_policy<8 & !is.na(dwest$immigrate_policy)],
     c("AN"), pos=1, col="darkblue")
legend("bottomright", pch=19, bty = "n",col=c("darkblue", "grey"), 
       legend=c("far right parties", "other parties"))


